﻿using ContactSMS.Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace ContactSMS.Infrastructure.Configs
{
    public class MessageSessionConfig : IEntityTypeConfiguration<MessageSession>
    {
        public void Configure(EntityTypeBuilder<MessageSession> builder)
        {
            builder.ToTable($"T_{nameof(MessageSession)}", t => t.HasComment("短信会话表"));
            builder.HasKey(t => t.Id);
            builder.Property(t => t.Mobile).HasColumnType("VARCHAR(20)").HasComment("电话");
            builder.Property(t => t.Desc).HasComment("消息内容");
            builder.Property(t => t.ContactId).HasComment("联系人id");
            builder.Property(t => t.UserId).HasDefaultValue(0).HasComment("用户id");
            builder.Property(t => t.SendTime).HasDefaultValue(0).HasComment("发送接收时间");
            builder.Property(t => t.CreatTime).HasComment("创建时间");
            builder.Property(t => t.UpdateTime).HasComment("更新时间");
        }
    }
}
